public class ProxySearcher extends Searcher{
    private Searcher searcher;
    private AccessValidator validator;
    private Logger logger;
    public ProxySearcher(Searcher searcher, Logger logger,AccessValidator validator) {
        this.searcher = searcher;
        this.validator = validator;
        this.logger = logger;
    }
    @Override
    public String doSearch(String userId, String keyword) {
        String result = null;
        if(validator.validate(userId)){
            result =  searcher.doSearch(userId, keyword);
            System.out.println(result);
        }
        else {
            System.out.println("验证失败");
        }
        logger.log(userId);
        return result;
    }
}
